home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Python 1.4 / twit / mactwit_edit.py < prev    next >
Encoding:
Python Source  |  1996-09-24  |  501 b   |  25 lines  |  [TEXT/Pyth]

  1. """Edit a file using the MetroWerks editor. Modify to suit your needs"""
  2.  
  3. import MacOS
  4. import aetools
  5. import Metrowerks_Shell_Suite
  6. import Required_Suite
  7.  
  8. _talker = None
  9.  
  10. class MWShell(aetools.TalkTo, 
  11.                  Metrowerks_Shell_Suite.Metrowerks_Shell_Suite,
  12.                  Required_Suite.Required_Suite):
  13.     pass
  14.  
  15. def edit(file, line):
  16.     global _talker
  17.     if _talker == None:
  18.         _talker = MWShell('CWIE', start=1)
  19.     try:
  20.         _talker.open(file)
  21.         _talker.Goto_Line(line)
  22.     except "(MacOS.Error, aetools.Error)":
  23.         pass
  24.      
  25.